﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using PowerCreator.LMS.Paper.Entiry;
using PowerCreator.LMS.Web.Paper;
using PowerCreator.LMS.Common.Script;

public partial class sysadmin_QuestionManager_EditPaperQuestion_Dialog : PowerCreator.LMS.Web.Base.BasePage
{

    ManagerPaper objManagerPaper = new ManagerPaper();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //ViewState["TypeID"] = Base64.Decode(Request.QueryString["TypeID"].ToString());
            ViewState["PQID"] = Request.QueryString["qid"].ToString();
            Pageload();
            InitPage();
        }
    }
    protected override void InitPage()
    {
        base.InitPage();
    }
    private void Pageload()
    {

        VOPaperQuestionTemp objVOPaperQuestionTemp = new VOPaperQuestionTemp();
        objVOPaperQuestionTemp = objManagerPaper.LoadPaperQuestionTemp(int.Parse(ViewState["PQID"].ToString()));
        ViewState["objVOPaperQuestionTemp"] = objVOPaperQuestionTemp;

        txtQuestionContent.Value = objVOPaperQuestionTemp.PaperQuestionTempContent;
         
        

        

        //QuestionInfo objQuestionInfo = new QuestionInfo();
        //objQuestionInfo = questionInfoManager.Load(int.Parse(ViewState["PQID"].ToString()));
        //ViewState["objQuestionInfo"] = objQuestionInfo;
        
    }


    protected void btnSave_Click(object sender, EventArgs e)
    {
        VOPaperQuestionTemp objVOPaperQuestionTemp = new VOPaperQuestionTemp();
        objVOPaperQuestionTemp = (VOPaperQuestionTemp)ViewState["objVOPaperQuestionTemp"];
        objVOPaperQuestionTemp.PaperQuestionTempContent = txtQuestionContent.Value;
        if (objManagerPaper.UpdatePaperQuestionTemp(objVOPaperQuestionTemp))
        {
            Script.Alert(GetLanageValueByKey("Msg_ManagerQuestion_WorkOK", PowerCreator.LMS.Language.LanagetItemType.Page));

        }
        else
        {
            Script.Alert(GetLanageValueByKey("Msg_ManagerQuestion_WorkNo", PowerCreator.LMS.Language.LanagetItemType.Page));
        }
    }
    protected void btn_back_Click(object sender, EventArgs e)
    {
        Script.ReloadParent();
        Script.CloseMe();
    }
}
